﻿<UserControl x:Class="CompareValidatorDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:IC="clr-namespace:Silverlight.InputCtrl;assembly=Silverlight.InputCtrl"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    mc:Ignorable="d" d:DesignWidth="640">
    <Grid x:Name="LayoutRoot" IC:ValidatorService.NewContext="True" Background="#FFFCFCFC" Margin="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="260"/>
            <ColumnDefinition Width="5"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="88" />
            <RowDefinition Height="88"/>
            <RowDefinition Height="58"/>
            <RowDefinition  />
        </Grid.RowDefinitions>
        <TextBlock x:Name="LblLng" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Grid.Column="2" Margin="0,40,0,0" FontWeight="Bold" Foreground="#FF577A26"/>
        <StackPanel Margin="5,0,0,0" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Top">
            <Button x:Name="BntVldAll" Margin="0" Content="Validate All" FontSize="12" Click="BntVldAll_Click"/>
            <Button x:Name="BntResetAll" Margin="10,0,0,0" VerticalAlignment="Top" Content="Reset Validators" d:LayoutOverrides="Width" FontSize="12" Click="BntResetAll_Click"/>
        </StackPanel>
        <Grid Margin="5,0,0,0" VerticalAlignment="Top">
        	<Grid.RowDefinitions>
        		<RowDefinition />
        		<RowDefinition Height="*" />
        	</Grid.RowDefinitions>
        	<Grid.ColumnDefinitions>
        		<ColumnDefinition Width="50*"/>
        		<ColumnDefinition Width="50*"/>
        	</Grid.ColumnDefinitions>
        	<TextBlock Margin="0" Text="Mask &quot;LongDate&quot;" TextWrapping="Wrap" FontSize="12" FontWeight="Bold" d:LayoutOverrides="Height" VerticalAlignment="Top">
        		<TextBlock.Foreground>
        			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        				<GradientStop Color="#FF1240DE" Offset="0"/>
        				<GradientStop Color="#FF0A0B0C" Offset="1"/>
        			</LinearGradientBrush>
        		</TextBlock.Foreground>
        	</TextBlock>
        	<TextBlock Margin="0,0,-44,0" Text="Mask &quot;LongTimeAMPM&quot;" TextWrapping="Wrap" FontSize="12" FontWeight="Bold" d:LayoutOverrides="GridBox" Grid.Column="1" VerticalAlignment="Top">
        		<TextBlock.Foreground>
        			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        				<GradientStop Color="#FF1240DE" Offset="0"/>
        				<GradientStop Color="#FF0A0B0C" Offset="1"/>
        			</LinearGradientBrush>
        		</TextBlock.Foreground>
        	</TextBlock>
        	<TextBlock Text="Enter a Date" TextWrapping="Wrap" FontSize="12" VerticalAlignment="Top" Grid.ColumnSpan="2" Grid.Row="1"/>
        	<IC:MaskedEdit x:Name="MaskDate" ReplaceEmptyNumeric="0" Margin="0,18,5,0" Mask="LongDate" FontSize="12" Background="#FFECE8E8" d:LayoutOverrides="Height" Grid.Row="1">
        		<IC:ValidatorService.Validators>
        			<IC:ValidatorCollection PropertyToValidate="TextUnMasked">
        				<IC:CompareValidator Operator="DataTypeCheck" DataType="Date" ErrorMessage="Date is invalid" />
        			</IC:ValidatorCollection>
        		</IC:ValidatorService.Validators>
        	</IC:MaskedEdit>
        	<TextBlock Text="Enter a Time" TextWrapping="Wrap" FontSize="12" VerticalAlignment="Top" Grid.Column="2" Grid.Row="1"/>
        	<IC:MaskedEdit x:Name="MaskTime" ReplaceEmptyNumeric="0" Margin="0,18,5,0" Mask="LongTimeAMPM" FontSize="12" Background="#FFECE8E8" d:LayoutOverrides="Height" Grid.Column="2" Grid.Row="1">
        		<IC:ValidatorService.Validators>
        			<IC:ValidatorCollection PropertyToValidate="TextUnMasked">
        				<IC:CompareValidator Operator="DataTypeCheck"  DataType="Time" TimeType="Hours12" ErrorMessage="Time is invalid" />
        			</IC:ValidatorCollection>
        		</IC:ValidatorService.Validators>
        	</IC:MaskedEdit>
        </Grid>
        <StackPanel Orientation="Vertical" Margin="5,-16,0,10" Grid.Row="1" Grid.ColumnSpan="1" d:LayoutOverrides="GridBox">
            <TextBlock Text="Enter a Password" TextWrapping="Wrap" FontSize="12"/>
            <TextBox x:Name="Text_pwd" FontSize="12" Background="#FFECE8E8" Margin="0" MaxLength="10">
                <IC:ValidatorService.Validators>
                    <IC:ValidatorCollection>
                        <IC:RequiredValidator ErrorMessage="Password is Required" />
                    </IC:ValidatorCollection>
                </IC:ValidatorService.Validators>
            </TextBox>
            <TextBlock Text="Confirm a Password" TextWrapping="Wrap" FontSize="12"/>
            <TextBox x:Name="Text_PwdConf" FontSize="12" Background="#FFECE8E8" Margin="0">
            	<IC:ValidatorService.Validators>
            		<IC:ValidatorCollection>
                        <IC:CompareValidator DataType="String" ControlToCompare="Text_pwd" Operator="Equal" ErrorMessage="Text is not the same Password Input" />
                    </IC:ValidatorCollection>
            	</IC:ValidatorService.Validators>
            </TextBox>
        </StackPanel>
        <StackPanel Orientation="Vertical" Grid.Row="3" Grid.ColumnSpan="3">
            <controls:TabControl x:Name="TabCode" Height="230" Margin="0,0,0,5">
                <controls:TabItem Header="Xaml Code" Foreground="#FF050505">
                    <Grid>
                        <ScrollViewer x:Name="ScrllXaml" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
                            <TextBox x:Name="LblXaml" TextWrapping="NoWrap"  FontSize="12" FontWeight="Bold" IsReadOnly="True" AcceptsReturn="True" />
                        </ScrollViewer>
                    </Grid>
                </controls:TabItem>
                <controls:TabItem Header="C# Code" Foreground="#FF050505">
                    <Grid>
                        <ScrollViewer x:Name="ScrllCode" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
                            <TextBox x:Name="LblCode" TextWrapping="NoWrap"  FontSize="12" FontWeight="Bold" IsReadOnly="True" AcceptsReturn="True" />
                        </ScrollViewer>
                    </Grid>
                </controls:TabItem>
            </controls:TabControl>
            <StackPanel Margin="5,5,0,0" Orientation="Horizontal">
                <Button x:Name="BntSelectAll" Content="Select  Text" Click="BntSelectAll_Click"/>
                <TextBlock Text="Use Ctrl +C to Copy from clipboad" TextWrapping="Wrap" VerticalAlignment="Center" Margin="10,0,0,0" FontWeight="Bold" Foreground="#FF5F5050"/>
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>
